from channels.layers import get_channel_layer
from asgiref.sync import async_to_sync


def notice_payment(cashier_id, msg):
    channel_layer = get_channel_layer()
    payload = {
        'type': 'pay.notice',
        'data': {
            'msg': msg,
        },
    }
    group_name = 'group_{}'.format(cashier_id)
    async_to_sync(channel_layer.group_send)(group_name, payload)
